home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PsL Monthly 1993 December
/
PSL Monthly Shareware CD-ROM (December 1993).iso
/
prgmming
/
dos
/
c
/
uw_1.exe
/
UW_DEMO.C
< prev
next >
Wrap
Text File
|
1992-11-12
|
45KB
|
1,306 lines
/****************************************************************************/
/* */
/* UW_DEMO.C */
/* Kevin Huck */
/* Boyd Gafford */
/* */
/* This demo program will show you many of the capabilities of UltraWin */
/* version 2.50. See the documentation for a complete function listing. */
/* */
/* NOTE: */
/* This file has a tab size of 2, and can be compiled and linked under */
/* small model. */
/* */
/****************************************************************************/
#include <stdlib.h>
#include <dos.h>
#include <stdio.h>
#include <ctype.h>
#include <conio.h>
#include <time.h>
#ifdef M_I86
#include <malloc.h>
#else
#include <alloc.h>
#endif
#include "uw.h"
#define NUM_WINS 26
typedef struct fields_struct /* structure for field input to the */
{ /* order form function! */
int num_fields; /* total number of fields */
char *input[10]; /* strings for the result */
char *mask[10]; /* masks for display on the screen */
char *t[10]; /* templates for validation */
int x[10]; /* positions for the input */
int y[10];
int strip[10]; /* strip masks on result? */
} FIELDS;
/*----------------- global variables for the demo program ------------------*/
WINDOW Main_wn, Print_wn[2];
WINDOW Back_wn, *Back_wnp = &Back_wn;
MENU Top_menu, *Top_mnp = &Top_menu;
MENU Terminal_menu, Setup_menu, Window_menu, Files_menu;
MENU *Drop_mnps[4];
uchar *Font8x14;
PRINT Printer1, Printer2;
char *Enque_strs[] =
{
"EnQue Software",
"Route 1, Box 116C",
"Pleasant Hill, MO, 64080",
"24-Hour BBS (816) 353-0991",
"Voice/Fax (816) 987-2515",
"(Voice 5-10pm and weekends)"
};
char Name[40], Address[40], City[30], State[10],
Zip[10], Phone[20], Password[10];
int Wait_for_key = 1;
/*------------------------ prototypes for the program ----------------------*/
void wn_3d_plst( int c, int r, char *str, WINDOW *wnp );
void wn_line_demo( void );
void wn_entry_demo( void );
void wn_color_demo( void );
void wn_create_demo( void );
void wn_scroll_demo( void );
void wn_prompt( char *prompt, int mode );
void wait( int mode );
void title_screen( void );
int wn_menu_demo( void );
int background_func( void );
void wn_change_att( uchar new_att, uchar old_att, WINDOW *wnp );
void wn_font_demo( void );
void wn_print_demo( void );
void disp_print_stats( PRINT *p, int mode, WINDOW *wnp );
/*********/
/* ~main */
/* ********************************************************************/
/****************************************************************************/
void main()
{
int r, end_flag = 0;
WINDOW *wnp;
init_video(80, 25);
init_mouse();
init_clock(0x3333);
wnp = &Main_wn;
wn_create( 0, 3, V_cols-1, V_rows-1, NO_BDR, WN_NORMAL, wnp );
wn_color( CYAN, BLUE, wnp );
wn_bdr_color( YELLOW, BLUE, wnp );
wn_name("Main_wn", wnp);
link_window(wnp);
title_screen();
wn_plst( CENTERED, (V_rows / 2) - 1,
"Welcome to the UltraWin Library!", wnp );
if( Ega )
wn_plst( CENTERED, 3,
"UltraWin detects the presence of an EGA compatible board", wnp);
else if( Vga )
wn_plst( CENTERED, 3,
"UltraWin detects the presence of a VGA compatible board", wnp);
wait(0);
wn_clear(wnp);
wn_color( BLUE, LIGHTGRAY, wnp );
wn_plst(1, 0, " Speed it one of many features incorporated into the UltraWin Library. ", wnp );
wn_plst(1, 1, " Here is a list of the main features, all of which will be demonstrated! ", wnp );
wn_color( YELLOW, BLUE, wnp );
wn_hline(2,SGL_BDR,wnp);
r = 3;
wn_plst(0, r++, "1) Complete range of windowing functions to dynamically create, update,", wnp );
wn_plst(0, r++, " move, and destroy an unlimited number of windows.", wnp );
wn_color( WHITE, BLUE, wnp );
wn_plst(0, r++, "2) A Window Manager that will handle all the hard work when multiple", wnp );
wn_plst(0, r++, " windows are on the screen.", wnp );
wn_color( YELLOW, BLUE, wnp );
wn_plst(0, r++, "3) Each window is fully buffered. Output to a window can take place at any", wnp );
wn_plst(0, r++, " time, even if another window overlaps it. This is perhaps, the", wnp );
wn_plst(0, r++, " most impressive feature. Windows can scroll output even if overlapped!", wnp );
wn_color( WHITE, BLUE, wnp );
wn_plst(0, r++, "4) Powerful string and data entry capabilities.", wnp );
wn_color( YELLOW, BLUE, wnp );
wn_plst(0, r++, "5) Powerful menuing capability with full mouse support!", wnp );
wn_color( WHITE, BLUE, wnp );
wn_plst(0, r++, "6) The library supports virtually any video board, including 43/50", wnp );
wn_plst(0, r++, " row EGA/VGA mode. It even works with non-standard modes i.e. 132*60.", wnp );
wn_color( YELLOW, BLUE, wnp );
wn_plst(0, r++, "7) UltraWin now works in EGA/VGA graphics mode and has user defined", wnp );
wn_plst(0, r++, " font capability in both text and graphics modes!", wnp );
wn_color( WHITE, BLUE, wnp );
wn_plst(0, r++, "8) EGA/VGA palette control and blink enable/disable to allow all 16", wnp );
wn_plst(0, r++, " background colors without foreground blinking.", wnp );
wn_color( YELLOW, BLUE, wnp );
wn_plst(0, r++, "9) UltraWin also has dynamic printer queues that can be either ram", wnp );
wn_plst(0, r++, " or disked based and can print to multiple devices in the background!", wnp );
wn_hline(r,SGL_BDR,wnp);
wait(0);
while( !end_flag )
{
wn_clear(wnp);
wn_color( BLUE, LIGHTGRAY, wnp );
r = 3;
wn_3d_plst(13, r++, "A) Color/Palette Control", wnp ), r++;
wn_3d_plst(13, r++, "B) Window Creation ", wnp ), r++;
wn_3d_plst(13, r++, "C) Text Line Drawing ", wnp ), r++;
wn_3d_plst(13, r++, "D) Window Scrolling ", wnp ), r++;
wn_3d_plst(13, r++, "E) Data Entry ", wnp ), r++;
r = 3;
wn_3d_plst(43, r++, "F) Drop-down Menus ", wnp ), r++;
wn_3d_plst(43, r++, "G) EGA/VGA Text Fonts ", wnp ), r++;
wn_3d_plst(43, r++, "H) Print Capabilities ", wnp ), r++;
wn_3d_plst(43, r++, "I) All of the Above ", wnp ), r++;
wn_color( RED, LIGHTGRAY, wnp );
wn_3d_plst(43, r++, "J) Quit Demo <<Esc>> ", wnp ), r++;
wn_color( BLUE, LIGHTGRAY, wnp );
if( Wait_for_key )
wn_3d_plst(13, r++, "K) Key press requirement between operations : ON ", wnp ), r++;
else
wn_3d_plst(13, r++, "K) Key press requirement between operations : OFF ", wnp ), r++;
r++;
wn_prompt("Select desired demo to execute...", 1);
wn_color( LIGHTGRAY, BLUE, wnp );
switch( toupper(Event.key) )
{
case 'Q': case 'J': case 27: end_flag = 1; break;
case 'A': wn_color_demo(); break;
case 'B': wn_create_demo(); break;
case 'C': wn_line_demo(); break;
case 'D': wn_scroll_demo(); break;
case 'E': wn_entry_demo(); break;
case 'F': wn_menu_demo(); break;
case 'G': wn_font_demo(); break;
case 'H': wn_print_demo(); break;
case 'I':
wn_color_demo();
wn_create_demo();
wn_line_demo();
wn_scroll_demo();
wn_entry_demo();
wn_menu_demo();
wn_font_demo();
wn_print_demo();
break;
case 'K': Wait_for_key = !Wait_for_key; break;
}
}
wn_destroy(wnp);
end_clock();
end_mouse();
end_video();
exit(0);
}
/*** end of main ***/
/***************/
/* ~wn_3d_plst */
/* **************************************************************/
/* This is specifically for the